﻿using System.Linq;
using WeBlog.Interfaces;
using WeBlog.Models;
using WeBlog.Repositories;

namespace WeBlog.Models
{
    public class ManageCategoriesViewModel : GridModel<Category>
    {
        private readonly IUnitOfWork _unitOfWork;        

        public ManageCategoriesViewModel(GridSettings settings, IUnitOfWork unitOfWork) :
            base(settings)
        {            
            Settings.DefaultSortColumn = "Name";
            _unitOfWork = unitOfWork;
        }


        public override IQueryable<Category> GetSuperSet()
        {
            var repository = new CategoryRepository(_unitOfWork);
            return repository.FindAll();
        }
    }
}